<include file="Common/header" />
<title>合同号列表</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理
	<span class="c-gray en">&gt;</span> 合同号管理
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<!--合同号生成-->
<div class="pd-20">
	<div class="codeView docs-example" data-afterContent="批量生成合同号">
		<table class="table table-border table-bordered table-striped">
			<tbody>
				<tr>
					<td align="right" width="10%" bgcolor="#f1f1f1">合同号开始：</td>
					<td width="20%">
						<input type="text" name="contract" id="contract" class="input-text radius" value="" />
					</td>
					<td align="right" width="10%" bgcolor="#f1f1f1">批量生成数量：</td>
					<td width="20%">
						<input type="text" name="counts" id="counts" class="input-text radius" value="" />
					</td>
					<td align="right" bgcolor="#f1f1f1" colspan="3" width="40%">
						<a class="btn btn-success radius l submitBtn" style="line-height:1.6em;margin-top:3px" href="javascript:void(0);" title="刷新" >生成</a>
					</td>
				</tr>
			</tbody>
		</table>
	</div>

	<div class="dataTables_wrapper no-footer" id="ajaxDiv">
		<include file="Member/contract_list" />
	</div>
</div>
<!--合同号生成完成-->
<script type="text/javascript">
	function admin_role_del(obj,id){
		layer.confirm('确认要删除吗？',function(index){
			$.post('contractrem.html', {cid: id}, function(rs){
				if(rs/1){
					layer.msg('删除成功', {icon:1,time: 2000}, function(){
						//location.reload();
					});
				}else{
					layer.msg('操作失败', {icon:2,time: 2000});
				}
			});
		});
	}

	$(document).ready(function(){
		//按条件查询
		$(".submitBtn").on('click', function(){
			var contract = $("#contract").val();
			var lastStr = contract.slice(-3);

			if(!contract.length){
				layer.msg('请输入合同编号', {icon: 5, time: 2000});
			}else if(isNaN(lastStr)){
				layer.msg('合同编号格式错误', {icon: 5, time: 2000});
			}else{
				var counts = $("#counts").val() || 0;
				if(isNaN(counts) || counts <= 0){
					layer.msg('请正确输入批量生成数量', {icon: 5, time: 2000});
					return false;
				}
				var load = layer.load(2);

				$.post('contract.html', {
					'contract': contract,
					'lastStr': lastStr,
					'counts': counts
				}, function(data){
					layer.close(load);
					if(data == '操作成功'){
						layer.msg('操作成功', {icon: 1, time: 2000}, function(){
							location.reload();
						});
					}else{
						layer.msg(data, {icon: 2, time: 2000});
					}
				});
			}
		});
	});
</script>
</body>
</html>